
//- This source code is licensed under the terms of the
//- GNU Affero General Public License found in the LICENSE file in
//- the root directory of this source tree.
//-
//- Copyright (c) 2021-present Kaleidos INC

.editor(ng-class="{'edit-mode': editMode, 'read-mode': !editMode, 'html-read-mode': htmlReadMode}")
    div(ng-if="outdated")
        p.outdated {{'COMMON.WYSIWYG.OUTDATED' | translate}}

    .wysiwyg.js-wysiwyg-html(
        ng-if="markdown.length"
        tg-bind-wysiwyg-html="markdown"
    )

    .wysiwyg.js-wysiwyg-html(
        ng-if="!markdown.length"
    )
        p.placeholder {{ placeholder }}

    .editor-wrapper

    .mode-editor(ng-if="editMode")
        a.help-markdown(
            ng-if="mode=='markdown'"
            href="https://community.taiga.io/t/taiga-markdown-syntax/191"
            target="_blank"
            title="{{'COMMON.WYSIWYG.MARKDOWN_HELP' | translate}}"
        )
            tg-svg(svg-icon="icon-question")
            span(translate="COMMON.WYSIWYG.MARKDOWN_HELP")

.tools(ng-class="{visible: editMode}")
    a.e2e-save-editor(
        variant="primary"
        class="btn-small"
        ng-class="{disabled: required && !markdown.length}"
        tg-loading="saving"
        href="#",
        ng-click="save($event)"
        translate="COMMON.SAVE"
    )

    a.e2e-cancel-editor(
        variant="secondary"
        class="btn-small"
        href="#",
        ng-click="cancelWithConfirmation($event)"
        title="{{ 'COMMON.CANCEL' | translate }}"
        translate="COMMON.CANCEL"
    )

